/**
 * Created by DUANLIN201 on 2016/2/21.
 */
var phPage = Backbone.View.extend({
   tagName: '',
    className: '',
    el: 'body',

    //事件绑定
    events: {
        "click #org_opt": "disOrg",
        "click #org_list": "disOrgMore"
    },
    initialize: function(){
        var self = this;
        self.disOrg();
    },

    requireData: function(reUrl,callBack){
        $.ajax({
            url: reUrl,
            type: "get",
            dataType: "json",
            success: function(data) {
                if (data && data.flag == 1) {
                    //alert(data);
                    //alert(data.orgInfo[0].orgName);
                    callBack(data);
                }
            }
        });
    },
    disOrg: function() {
        var self = this;
        self.requireData("js/data/org.json",function(data){
            //alert(data);
            $('#personContainer').html(_.template($('#my_org').html())(data));
        });
    },

    disOrgMore: function() {
        var self = this;
        //alert("da");
        self.requireData("js/data/orgMore.json",function(data) {
            alert(data.orgName);
            $('#personContainer').html(_.template($('#org_more').html())(data));
        })
    }

});
$(function(){
    new phPage();
});